package cn.ex.ymcc.feign.fallback;

import cn.ex.ymcc.feign.SysDicFeignClient;
import cn.ex.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: ZeWangmu
 * @Date: 2022/08/16/14:57
 * @Description:
 */
@Component
public class SysDicFeignClientFallback implements FallbackFactory<SysDicFeignClient> {
    @Override
    public SysDicFeignClient create(Throwable throwable) {
        return new SysDicFeignClient() {
            @Override
            public JSONResult findSysDic() {
                throwable.printStackTrace();
                return JSONResult.error("服务不可达");
            }
        };
    }
}
